<!-- 批次库存查询 - 综合表单页面 -->
<template>
  <div class="page-container">
    <ex_super_table_page v-bind="option" ref="SuperTablePage">
    </ex_super_table_page>
    <el-dialog :title="$tt('label_stock_detail')" :visible.sync="dialogVisible" width="1100px">
      <ex_super_table class="el-table-nowwarp" ref="resourceDownloadGridPanelEl"
        :url="'/oms-api/stock/OmsStockQueryRpc/stockContainerQuery.json?batchId=' + chooseRowId"
        :attrs="{ autoPage: true, autoLoad: true }" height="400" v-bind="tableOption">
      </ex_super_table>
      <span slot="footer" class="dialog_footer">
        <el-button @click="dialogVisible = false">{{ $tt('label_close') }}</el-button>
      </span>
    </el-dialog>

    <!-- <el-dialog :title="$tt('label_stock_detail')" :visible.sync="dialogVisible" width="1000px">
      <ex-table-auto class="el-table-nowwarp" ref="resourceDownloadGridPanelEl"
        :url="'/oms-api/stock/OmsStockQueryRpc/stockContainerQuery.json?batchId=' + chooseRowId" :autoFill="false"
        autoPage border max-height="400">
        <el-table-column type="index" label="#" width="43"></el-table-column>

        <el-table-column prop="locationCode" :label="$tt('label_warehouse_location_code')"
          min-width="8"></el-table-column>
        <el-table-column prop="subContainerCode" :label="$tt('label_container_code')" min-width="8"></el-table-column>
        <el-table-column prop="isTmpLocation" :label="$tt('label_staging_area')" min-width="8"></el-table-column>
        <el-table-column prop="stockKind" :label="$tt('label_stock_quality')" min-width="8">
          <template slot-scope="scope">
            {{ $enumShow(scope.row.stockKind, 'StockKindEnum') }}
          </template>
        </el-table-column>
        <el-table-column prop="freezeQty" :label="$tt('label_frozen_count')" min-width="8"></el-table-column>
        <el-table-column prop="lockQty" :label="$tt('label_lock_count')" min-width="8"></el-table-column>
        <el-table-column prop="usableQty" :label="$tt('label_usable_count')" min-width="8"></el-table-column>
        <el-table-column prop="totalQty" :label="$tt('label_container_inner_sum_count')" min-width="8"></el-table-column>
        <el-table-column prop="putawayTime" :label="$tt('label_putaway_time')" min-width="8">
          <template slot-scope="scope">
            {{ $dateFormat(scope.row.putawayTime) }}
          </template>
        </el-table-column>
      </ex-table-auto>
      <span slot="footer" class="dialog_footer">
        <el-button @click="dialogVisible = false">{{ $tt('label_close') }}</el-button>
      </span>
    </el-dialog> -->


  </div>
</template>
<script>
import { mapState } from "vuex";


export default {
  title: 'title_stock_batch_query',
  components: {},
  data() {
    return {

      dialogVisible: false,

      chooseRowId: 0,

      option: {
        //搜索框内容
        search: {
          //搜索框内容，key为搜索字段，label为标签提示
          model: [
            { label: "label_customer", key: "customerId", type: 'common_customer_choose',},
            { label: "label_sku", key: "skuId", type: 'sku_selec_input', },
            {label: "label_business_type", key: "bizType", type: 'select', enum: 'BizTypeEnum'},
          ],
        },
        action: [
        ],

        table: {
          url: "/oms-api/stock/OmsStockQueryRpc/stockBatchQuery.json",
          attrs: {},
          model: [
            {
              key: 'warehouseId', label: 'label_warehouse',
              attrs: {
                formatter: (r, c, v, i) => this.$formatNameCode(this.allWarehouseMap[v].name, this.allWarehouseMap[v].code)
              }
            },
            {
              key: 'batchNo', label: 'label_batch_code',
            },
            {
              key: 'customerCode', label: 'label_srm_api_request_customer_code',
            },
            {
              key: 'customerName', label: 'label_customer_name',
            },
            {
              key: 'skuBarcode', label: 'label_sku_code',
              attrs: {
                formatter: (r, c, v, i) => r.skuId < 0 ? "——" : v
              }
            },
            {
              key: 'skuOnlyCode', label: 'label_sku_only_code',
              attrs: {
                formatter: (r, c, v, i) => r.skuId < 0 ? "——" : v
              }
            },

            {
              key: 'skuName', label: 'label_sku_name', formatter: (r, c, v) => r.skuId < 0 ? "——" :this.$formatNameCode(v, r.skuNameEn)
            },
            {
              key: 'freezeQty', label: 'label_frozen_count',
            },
            {
              key: 'lockQty', label: 'label_lock_count',
            },
            {
              key: 'usableQty', label: 'label_usable_count',
            },
            {
              key: 'totalQty', label: 'label_sum',
            },
            {
              type: 'operate', width: 160, operate: [

                {
                  label: 'label_view_detail', click: (row) => {
                    this.chooseRowId = row.id
                    this.dialogVisible = true
                  }
                }

              ],
            }
          ],

        }
        ,

      },
      tableOption: {
        model: [
          { key: 'locationCode', label: 'label_warehouse_location_code', 'min-width': 140, 'show-overflow-tooltip': true, },
          { key: 'subContainerCode', label: 'label_container_code', 'min-width': 140, 'show-overflow-tooltip': true, },
          { key: 'isTmpLocation', label: 'label_staging_area', 'width': 120, 'show-overflow-tooltip': true, },
          { key: 'stockKind', label: 'label_stock_quality', 'width': 120, 'show-overflow-tooltip': true, formatter: (r, c, v) => this.$enumShow(v, 'StockKindEnum') },

          { key: 'freezeQty', label: 'label_frozen_count', 'width': 120, 'show-overflow-tooltip': true, },

          { key: 'lockQty', label: 'label_lock_count', 'width': 120, 'show-overflow-tooltip': true, },
          { key: 'usableQty', label: 'label_usable_count', 'width': 120, 'show-overflow-tooltip': true, },

          { key: 'totalQty', label: 'label_container_inner_sum_count', 'width': 120, 'show-overflow-tooltip': true, },

          { key: 'putawayOrderNo', label: 'label_putaway_code', 'width': 120, 'show-overflow-tooltip': true, },

          { key: 'putawayTime', label: 'label_putaway_time', 'width': 130, 'show-overflow-tooltip': true, formatter: (r, c, v) => this.$dateFormat(v) },


        ]
      },
    };
  },
  computed: {
    ...mapState({ allWarehouseMap: state => state.allWarehouseMap }),
  },
  methods: {
  }
};

</script>
<style></style>
